﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DTO;
using System.Data.SqlClient;
namespace DAO
{
    public class TheLoaiPhimDAO
    {
        public static List<TheLoaiPhim> LayDSTheLoai()
        {
            List<TheLoaiPhim> dsTL = new List<TheLoaiPhim>();
            SqlConnection cn;
            cn = DataProvider.ConnectionData();
            string strSQL;
            strSQL = "Select * From TheLoaiPhim";
            SqlCommand cmd = new SqlCommand(strSQL, cn);
            SqlDataReader dr;
            dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                TheLoaiPhim tl = new TheLoaiPhim();
                tl.MaTheLoaiPhim = (int)dr["MaTheLoaiPhim"];
                tl.TenTheLoaiPhim = (String)dr["TenTheLoaiPhim"];
                dsTL.Add(tl);
            }
            dr.Close();
            cn.Close();
            return dsTL;
        }
    }
}
